package top.dreamix.njitkit.data.network

import androidx.compose.runtime.Composable
import cafe.adriel.lyricist.LocalStrings
import kotlinx.serialization.Serializable

@Serializable
enum class Operator {
    CAMPUS_NET,
    CHINA_MOBILE,
    CHINA_UNICOM,
    CHINA_TELECOM;

    val displayName: String
        @Composable
        get() = when (this) {
            CAMPUS_NET -> LocalStrings.current.operatorCampusNet
            CHINA_MOBILE -> LocalStrings.current.operatorChinaMobile
            CHINA_UNICOM -> LocalStrings.current.operatorChinaUnicom
            CHINA_TELECOM -> LocalStrings.current.operatorChinaTelecom
        }

    val suffix: String get () =
        when (this) {
            CAMPUS_NET -> ""
            CHINA_MOBILE -> "@cmcc"
            CHINA_UNICOM -> "@telecom"
            CHINA_TELECOM -> "@unicom"
        }
}

@Serializable
data class Account(
    val id: String, // Unique identifier
    val username: String,
    val operator: Operator,
    val password: String = "",
    val tryLoginOffHours: Boolean = false,
) {
    // In a real app, you might have a more complex model for this
    val offHoursConfig: String = ""
}

@Serializable
data class NetworkSetting(
    var defaultAccountId: String? = null,
    var autoLogin: Boolean = false
)